import Mock from 'mockjs';

// eslint-disable-next-line consistent-return
Mock.mock('api.com', (option) => {
  if (option.type === 'GET') {
    if (option.url === 'api.com') {
      return Mock.mock({
        'image|3': ['@image("1237X626","@color","#ffffff","png","@string")'],
        'search|2-4': '@cword', // 随机生成的文字
      });
    }
  }
});
// eslint-disable-next-line consistent-return
Mock.mock('abc.com', (option) => {
  if (option.type === 'GET') {
    if (option.url === 'abc.com') {
      return Mock.mock({
        'num|10': [{
          'image|1': ['@image("626X1237","@color","#ffffff","png","@string")'],
          'word|10-20': '@cword', // 随机生成的文字
          'word_1|4': '@cword', // 随机生成的文字
          'word_2|4': '@cword', // 随机生成的文字
          'word_3|4': '@cword', // 随机生成的文字
          number: '@float(1,20,1,1)',
          money: '@float(1,20,1,1)', // 随机的价格
          age: '@natural(1000,10000)', //
        }],
      });
    }
  }
});
// eslint-disable-next-line consistent-return
Mock.mock('qwe.com', (option) => {
  if (option.type === 'GET') {
    if (option.url === 'qwe.com') {
      return Mock.mock({
        'image|4': ['@image("1237X626","@color","#ffffff","png","@string")'],
        money: '@float(1,20,1,1)',
      });
    }
  }
});
// eslint-disable-next-line consistent-return
Mock.mock('aaa.com', (option) => {
  if (option.type === 'GET') {
    if (option.url === 'aaa.com') {
      return Mock.mock({
        'image|3': ['@image("1237X626","@color","#ffffff","png","@string")'],
        'word|5': '@cword', // 随机生成五个文字
        number: '@float(1,20,1,1)',
      });
    }
  }
});
// eslint-disable-next-line consistent-return
Mock.mock('bbb.com', (option) => {
  if (option.type === 'GET') {
    if (option.url === 'bbb.com') {
      return Mock.mock({
        'commodity|6': [{
          'word|2-10': '@cword',
        }],
      });
    }
  }
});
